package com.nnnu.orange.pojo.entity;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.io.Serializable;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

/**
 * <p>
 * 存储每本图书的详细信息
 * </p>
 *
 * @author zk
 * @since 2024-11-07
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("books")
@ApiModel(value = "Books对象", description = "存储每本图书的详细信息")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Books implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "图书唯一标识")
    @TableId(value = "book_id", type = IdType.AUTO)
    private Integer bookId;

    @ApiModelProperty(value = "书名")
    private String title;

    @ApiModelProperty(value = "副标题")
    private String subtitle;

    @ApiModelProperty(value = "作者ID（关联authors表）")
    private Integer authorId;

    @ApiModelProperty(value = "类别ID（关联categories表）")
    private Integer categoryId;

    @ApiModelProperty(value = "ISBN编号")
    private String isbn;

    @ApiModelProperty(value = "出版日期")
    private LocalDate publishedDate;

    @ApiModelProperty(value = "页数")
    private Integer pageCount;

    @ApiModelProperty(value = "语言")
    private String language;

    @ApiModelProperty(value = "可用库存数量")
    private Integer availableCopies;

    @ApiModelProperty(value = "总库存数量")
    private Integer totalCopies;

    @ApiModelProperty(value = "书架位置")
    private String shelfLocation;

    @ApiModelProperty(value = "图书描述")
    private String description;

    @ApiModelProperty(value = "封面图片URL")
    private String coverImageUrl;

    @ApiModelProperty(value = "入库日期")
    private LocalDateTime addedDate;

    @ApiModelProperty(value = "图书评分")
    private BigDecimal rating;

    @ApiModelProperty(value = "格式")
    private String format;

    @ApiModelProperty(value = "状态")
    private Integer status;

    @ApiModelProperty(value = "类型（文学、科技、艺术等）")
    private String genre;

    @ApiModelProperty(value = "版本信息")
    private String edition;

    @ApiModelProperty(value = "标签（关键字）")
    private String tags;

    @ApiModelProperty(value = "乐观锁版本号")
    @Version
    @TableField(fill = FieldFill.INSERT_UPDATE)   //添加元素时自动填充
    private Integer version; // 乐观锁版本号


}
